<h1>graph</h1>
<script  type="text/javascript">

   $(function() {
   chart = new Highcharts.Chart({
      chart: {
        renderTo: "comments_chart"
		

      },
      title: {
        text: "comments"
      },
      xAxis: {
         categories: [
            'Score'
         ]
      },


      yAxis: {
        title: {
          text: "DATA"
        }

      },
	   
	  series: [

  {
    name: "doga",
    
    data: <%= Post.where(:name => 'doga').all.map(&:earn) %>
  },
   {
    name: "priyanshu",
    color: '#DBD200',
    data: <%= Post.where(:name => 'priyanshu').all.map(&:earn) %>
  }
  ,
   {
    name: "saurav",
    color: '#1B7B94',
    data: <%= Post.where(:name => 'saurav').all.map(&:earn) %>
  }]

   });
   
   
});


</script>
<div id="comments_chart" style="width:660px; height:500px;"></div>

<table>
  <tr>
    <th>Id</th>
    <th>Name</th>
    <th>Date</th>
    <th>Earn</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @posts.each do |post| %>
  <tr>
    <td><%= post.id %></td>
    <td><%= post.name %></td>
    <td><%= post.date %></td>
    <td><%= post.earn %></td>
    <td><%= link_to 'Show', post %></td>
    <td><%= link_to 'Edit', edit_post_path(post) %></td>
    <td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Post', new_post_path %>
